package com.zjdiepu.www.base.core;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.alibaba.fastjson.annotation.JSONField;
import com.zjdiepu.www.base.enums.status.DpStatus;
import com.zjdiepu.www.common.util.StringUtil;

/**
 * 查询条件公共字段
 * 
 * @author xiongxiaotun
 * @date 2017年3月22日 下午1:50:35
 * @since v1.0.0
 * @update
 */
@ApiModel(value="BaseExt", description="公共查询条件")
public class BaseExt implements Serializable {
	private static final long serialVersionUID = 1L;
	/**
	 * 主键
	 */
	@JSONField(name = "replaceId")
	@ApiModelProperty(name="replaceId",required=false,value="主键",example="1", hidden=true)
	private String id;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	/**
	 * 排序字段
	 */
	@ApiModelProperty(name="sortValue",required=false,value="排序", example="0", hidden=true)
	private Integer sortValue;
	
	/**
	 * 排序sql
	 */
	@ApiModelProperty(name="orderSql",required=false,value="排序语句", hidden=true)
	private String orderSql;

	/**
	 * 创建人
	 */
	@ApiModelProperty(name="creator",required=false,value="创建人",example="1",hidden=true)
	private String creator;
	
	/**
	 * 创建人名称
	 */
	@ApiModelProperty(name="creatorName",required=false,value="创建人名称",example="超级管理员",hidden=true)
	private String creatorName;

	/**
	 * 创建时间
	 */
	@ApiModelProperty(name="created",required=false,value="创建时间",example="1492584422",hidden=true)
	private Integer created;

	/**
	 * 创建时间：开始
	 */
	@ApiModelProperty(name="createdStart",required=false,value="创建开始时间",example="2017-03-13 13:23:32",hidden=true)
	private Date createdStart;

	/**
	 * 创建时间：结束
	 */
	@ApiModelProperty(name="createdEnd",required=false,value="创建结束时间",example="2017-03-18 13:23:32",hidden=true)
	private Date createdEnd;

	/**
	 * 修改人
	 */
	@ApiModelProperty(name="modifier",required=false,value="修改人",example="1",hidden=true)
	private String modifier;
	
	/**
	 * 修改人名称
	 */
	@ApiModelProperty(name="modifierName",required=false,value="修改人名称",example="超级管理员",hidden=true)
	private String modifierName;

	/**
	 * 修改时间
	 */
	@ApiModelProperty(name="modified",required=false,value="修改时间",example="1492584422",hidden=true)
	private Integer modified;

	/**
	 * 修改时间：开始
	 */
	@ApiModelProperty(name="modifiedStart",required=false,value="修改开始时间",example="2017-03-13 13:23:32",hidden=true)
	private Date modifiedStart;

	/**
	 * 修改时间：结束
	 */
	@ApiModelProperty(name="modifiedEnd",required=false,value="修改结束时间",example="2017-03-18 13:23:32",hidden=true)
	private Date modifiedEnd;
	
	/**
	 * 数据状态
	 * {@link DpStatus}
	 */
	@ApiModelProperty(name="dpStatus",required=false,value="数据状态",example="1",hidden=true)
	private Integer dpStatus;
	
	/**
	 * 基本查询条件
	 */
	@ApiModelProperty(name="notDeleted",required=false,value="没有删除",example="true", hidden=true)
	private Boolean notDeleted;
	
	/**
	 * 排序字段
	 */
	@ApiModelProperty(name="sidx",required=false,value="排序字段",example="id",hidden=true)
	private String sidx;
	/**
	 * 排序规则
	 */
	@ApiModelProperty(name="sord",required=false,value="排序规则",example="desc",hidden=true)
	private String sord;
	
	/**
	 * 备用字段1
	 */
	@ApiModelProperty(name="ccol1",required=false,value="备用字段1",example="备用字段1",hidden=true)
	private String ccol1;
	
	/**
	 * 备用字段2
	 */
	@ApiModelProperty(name="ccol2",required=false,value="备用字段2",example="备用字段2",hidden=true)
	private String ccol2;
	
	/**
	 * 备用字段3
	 */
	@ApiModelProperty(name="ccol3",required=false,value="备用字段3",example="备用字段3",hidden=true)
	private String ccol3;
	
	/**
	 * 备用字段4
	 */
	@ApiModelProperty(name="dcol1",required=false,value="备用字段4",example="123",hidden=true)
	private BigDecimal dcol1;
	
	/**
	 * 备用字段5
	 */
	@ApiModelProperty(name="dcol2",required=false,value="备用字段4",example="123",hidden=true)
	private BigDecimal dcol2;
	
	/**
	 * 数据类型:1.系统生成 2.导入数据
	 */
	@ApiModelProperty(name="typeData",required=false,value="数据类型:1.系统生成 2.导入数据",example="1",hidden=true)
	private Integer typeData;
	
	
	/**
	 * 基本查询条件:未分配
	 */
	@ApiModelProperty(name="notAllocation",required=false,value="没有删除",example="true", hidden=true)
	private Boolean notAllocation;
	
	@ApiModelProperty(name="whereSql",required=false,value="条件", hidden=true)
	private String whereSql;
	
	/** 
	 * @author zhangpp
	 * @return whereSql 
	 * @version V1.0
	 */
	public String getWhereSql() {
		return whereSql;
	}
	/** 
	 * @author zhangpp
	 * @param whereSql 要设置的 whereSql 
	 * @version V1.0
	 */
	public void setWhereSql(String whereSql) {
		this.whereSql = whereSql;
	}
	
	/**
	 * @author xiongxiaotun <br/>
	 * @Title: notDeleted  <br/>
	 * @Description: 未删除的数据 <br/>
	 * @version V1.0  <br/>
	 */
	public void notDeleted(){
		this.notDeleted = true;
	}
	
	/**
	 * @author xiongxiaotun <br/>
	 * @Title: notAllocation  <br/>
	 * @Description: 未分配的数据 <br/>
	 * @version V1.0  <br/>
	 */
	public void notAllocation(){
		this.notAllocation = true;
	}
	
	/**
	 * @author xiongxiaotun <br/>
	 * @Title: setBaseWhere  <br/>
	 * @Description: 一般条件 <br/>
	 * @version V1.0  <br/>
	 */
	public void setBaseWhere(){
		setDpStatus(DpStatus.NORMAL.getCode());
	}

	public final Boolean getNotAllocation() {
		return notAllocation;
	}

	public final void setNotAllocation(Boolean notAllocation) {
		this.notAllocation = notAllocation;
	}
	
	public Integer getSortValue() {
		return sortValue;
	}

	public void setSortValue(Integer sortValue) {
		this.sortValue = sortValue;
	}

	public String getOrderSql() {
		if(StringUtils.isNotBlank(sidx)) {
			orderSql = StringUtil.toColumnsName(sidx);
			if(StringUtils.isNotBlank(sord)) {
				orderSql += " " + sord.toUpperCase();
			}
		}
		return orderSql;
	}

	public void setOrderSql(String orderSql) {
		this.orderSql = orderSql;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public Date getCreatedStart() {
		return createdStart;
	}

	public void setCreatedStart(Date createdStart) {
		this.createdStart = createdStart;
	}

	public Date getCreatedEnd() {
		return createdEnd;
	}

	public void setCreatedEnd(Date createdEnd) {
		this.createdEnd = createdEnd;
	}

	public String getModifier() {
		return modifier;
	}

	public void setModifier(String modifier) {
		this.modifier = modifier;
	}

	public Date getModifiedStart() {
		return modifiedStart;
	}

	public void setModifiedStart(Date modifiedStart) {
		this.modifiedStart = modifiedStart;
	}

	public Date getModifiedEnd() {
		return modifiedEnd;
	}

	public void setModifiedEnd(Date modifiedEnd) {
		this.modifiedEnd = modifiedEnd;
	}
	
	public String getCreatorName() {
		return creatorName;
	}

	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}

	public String getModifierName() {
		return modifierName;
	}

	public void setModifierName(String modifierName) {
		this.modifierName = modifierName;
	}

	public Integer getDpStatus() {
		return dpStatus;
	}

	public void setDpStatus(Integer dpStatus) {
		this.dpStatus = dpStatus;
	}

	public Integer getCreated() {
		return created;
	}

	public void setCreated(Integer created) {
		this.created = created;
	}

	public Integer getModified() {
		return modified;
	}

	public void setModified(Integer modified) {
		this.modified = modified;
	}

	public Boolean getNotDeleted() {
		return notDeleted;
	}

	public void setNotDeleted(Boolean notDeleted) {
		this.notDeleted = notDeleted;
	}

	public String getSidx() {
		return sidx;
	}

	public void setSidx(String sidx) {
		this.sidx = sidx;
	}

	public String getSord() {
		return sord;
	}

	public void setSord(String sord) {
		this.sord = sord;
	}

	public String getCcol1() {
		return ccol1;
	}

	public void setCcol1(String ccol1) {
		this.ccol1 = ccol1;
	}

	public String getCcol2() {
		return ccol2;
	}

	public void setCcol2(String ccol2) {
		this.ccol2 = ccol2;
	}

	public String getCcol3() {
		return ccol3;
	}

	public void setCcol3(String ccol3) {
		this.ccol3 = ccol3;
	}

	public BigDecimal getDcol1() {
		return dcol1;
	}

	public void setDcol1(BigDecimal dcol1) {
		this.dcol1 = dcol1;
	}

	public BigDecimal getDcol2() {
		return dcol2;
	}

	public void setDcol2(BigDecimal dcol2) {
		this.dcol2 = dcol2;
	}

	public Integer getTypeData() {
		return typeData;
	}

	public void setTypeData(Integer typeData) {
		this.typeData = typeData;
	}
}
